package com.sc.controller.rui;

import com.sc.result.Result;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.ExceptionHandler;

/**
 * @Description:
 * @Author: Rui
 * @Date: 2024/11/25 9:23
 */
//全局异常异常处理类
@ControllerAdvice
@CrossOrigin
public class ErrorController {
    @ExceptionHandler(Exception.class)
    public Result error(Exception e) {
        e.printStackTrace();
        return Result.success(e.getMessage(), false);
    }
}
